#!/usr/bin/env python
def getInt(n):
	d = []
	digitPos = 100000
	i = 6;
	while (i != 0):
		temp = n / digitPos;
		d.append(temp);
		n = n - (temp * digitPos)
		digitPos = digitPos / 10;
		i -= 1;
	return d

def palindrome(number):
	d = [];
	Pi = 0;
	Pf = 0;
	d = getInt(number);
	Pf = len(d) - 1; 
	
	if(d[0] == 0):
		Pi += 1;
		if(d[1] == 0):
			Pi += 1;

	while (Pi != Pf):
		if(d[Pi] == d[Pf]):
			#print number;
			#print d[Pi], " vs ", d[Pf];
			Pi += 1;
			Pf -= 1;
		else:
			#print number;
			#print d[Pi], " vs ", d[Pf];
			break;
		
		if(Pi >= Pf):
			break;


	if(Pi >= Pf) and (Pi != 0):
		return True;
	else:
		return False;

	


palin = [];
number = 0;
numberA = 999;
numberB = 999;
largest = 0

while(numberA > 99):
	while(numberB > 99):
		number = numberA * numberB;
		palin = palindrome(number);
		if(palin == True):
			#print numberA, " AND " , numberB;
			if (number > largest):
				largest = number;
			break
		else:
			numberB -= 1;

	numberB = 999;
	numberA -= 1;

print largest;
#print number;
#print palin;

